home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 4_0 / LISTMANA / __TESTER / TESTERME.C < prev    next >
Text File  |  1989-06-25  |  3KB  |  167 lines

  1. /****                                                                    */
  2. /****    Code Testing System version 1.0 (beta)                            */
  3. /****                                                                    */
  4. /****    All portions of this source code are the property of Jack        */
  5. /****    Herrington.  I, Jack Herrington, give you permission to use        */
  6. /****    use or alter the code in any way that pleases you.  You must    */
  7. /****    however return by whatever means avaliable any improvements        */
  8. /****    you believe significant to Jack Herrington, accepting that        */
  9. /****    these improvements might be contained in later releases of        */
  10. /****    the code. I also grant you permission to remove this header        */
  11. /****    from any file you are WORKING on, as long as you put it back    */
  12. /****    when you're stopped WORKING on it.                                */
  13. /****                                                                    */
  14. /****    Jack Herrington: University Of Miami, Biomedical Computing        */
  15. /****                     1600 N.W. 10th Ave. (R-53)                        */
  16. /****                     (305) 547-6538                                    */
  17. /****                                                                    */
  18.  
  19. /****/
  20. /**** Tester message service */
  21. /****/
  22.  
  23. #include "Tester.h"
  24.  
  25. /****/
  26. /**** Send an key-stroke */
  27. /****/
  28.  
  29. void TesterKey(win,ch)
  30. int win;
  31. unsigned char ch;
  32. {
  33.     CurHandler = Windows[win].handler;
  34.     CurWindow = win;
  35.  
  36.     SetPort(Windows[CurWindow].window);
  37.  
  38.     TesterLockWindowInfo();
  39.     (*Handlers[CurHandler].base)(MESS_KEY,&ch);
  40.     TesterUnLockWindowInfo();
  41. }
  42.  
  43. /****/
  44. /**** Send an open command */
  45. /****/
  46.  
  47. void TesterOpenHandler(hand)
  48. int hand;
  49. {
  50.     CurHandler = hand;
  51.     CurWindow = (-1);
  52.  
  53.     (*Handlers[CurHandler].base)(MESS_NEW,(unsigned char *)0L);
  54. }
  55.  
  56. /****/
  57. /**** Update a particular window */
  58. /****/
  59.  
  60. void TesterUpdate(win)
  61. int win;
  62. {
  63.     CurHandler = Windows[win].handler;
  64.     CurWindow = win;
  65.  
  66.     SetPort(Windows[CurWindow].window);
  67.  
  68.     TesterLockWindowInfo();
  69.     (*Handlers[CurHandler].base)(MESS_UPDATE,(unsigned char *)0L);
  70.     TesterUnLockWindowInfo();
  71. }
  72.  
  73. /****/
  74. /**** Send a hit to the handler of a window */
  75. /****/
  76.  
  77. void TesterHitInWindow(window,hit)
  78. WindowPtr window;
  79. int hit;
  80. {
  81.     int win;
  82.  
  83.     win = TesterFindProgWindow(window);
  84.     CurHandler = Windows[win].handler;
  85.     CurWindow = win;
  86.  
  87.     SetPort(Windows[CurWindow].window);
  88.  
  89.     TesterLockWindowInfo();
  90.     (*Handlers[CurHandler].base)(MESS_HIT,(unsigned char *)&hit);
  91.     TesterUnLockWindowInfo();
  92. }
  93.  
  94. /****/
  95. /**** Send an activate event to the handler of a window */
  96. /****/
  97.  
  98. void TesterActivate(window)
  99. WindowPtr window;
  100. {
  101.     int win;
  102.  
  103.     win = TesterFindProgWindow(window);
  104.     CurHandler = Windows[win].handler;
  105.     CurWindow = win;
  106.  
  107.     SetPort(Windows[CurWindow].window);
  108.  
  109.     TesterLockWindowInfo();
  110.  
  111.     if ( window == FrontWindow() ) (*Handlers[CurHandler].base)(MESS_ACTIVATE,0L);
  112.     else (*Handlers[CurHandler].base)(MESS_DEACTIVATE,0L);
  113.  
  114.     TesterUnLockWindowInfo();
  115. }
  116.  
  117. /****/
  118. /**** Send an idle message  */
  119. /****/
  120.  
  121. void TesterSendIdle(win)
  122. int win;
  123. {
  124.     CurHandler = Windows[win].handler;
  125.     CurWindow = win;
  126.  
  127.     SetPort(Windows[CurWindow].window);
  128.  
  129.     TesterLockWindowInfo();
  130.     (*Handlers[CurHandler].base)(MESS_IDLE,(unsigned char *)0L);
  131.     TesterUnLockWindowInfo();
  132. }
  133.  
  134. /****/
  135. /**** Send a close message */
  136. /****/
  137.  
  138. void TesterCloseWindow(win)
  139. int win;
  140. {
  141.     CurHandler = Windows[win].handler;
  142.     CurWindow = win;
  143.  
  144.     SetPort(Windows[CurWindow].window);
  145.  
  146.     TesterLockWindowInfo();
  147.     (*Handlers[CurHandler].base)(MESS_CLOSE,(unsigned char *)0L);
  148.     TesterUnLockWindowInfo();
  149. }
  150.  
  151. /****/
  152. /**** Send a growRegion hit message */
  153. /****/
  154.  
  155. void TesterSendGrow(win)
  156. int win;
  157. {
  158.     CurHandler = Windows[win].handler;
  159.     CurWindow = win;
  160.  
  161.     SetPort(Windows[CurWindow].window);
  162.  
  163.     TesterLockWindowInfo();
  164.     (*Handlers[CurHandler].base)(MESS_GROW,(unsigned char *)0L);
  165.     TesterUnLockWindowInfo();
  166. }
  167.